﻿function showmessage(idMsg,titulo,msg,tipo,icon,vautoClose) {
	var html = ''
	
	if (tipo.toUpperCase() == 'CONFIRMAR') {		
		icon = '/projeto/images/icon-confirmar.png';
		var botao = '<input type="button" id="ok" value="SIM" style="margin-right: 10px" />' +
					'<input type="button" id="cancel" value="NÃO" />';
			
		html = '<div id="wmsg"><div>' +
			   '     <img width="14" height="14" src="' + icon + '" alt="" />&nbsp;&nbsp;&nbsp;' + titulo +
			   '</div>' +
			   '<div>' +
			   '    <div>' +
							msg +
			   '    </div>' +
			   '    <div>' +
			   '    <div align="center" style="float: auto; margin-top: 30px;">' +
						botao +
			   '    </div>' +
			   '    </div>' +
			   '</div></div>';
	
		$('#containerMsg').html(html);
		
		$('#wmsg').jqxWindow({
			maxHeight: 150, 
			maxWidth: 280, 
			minHeight: 30, 
			minWidth: 250, 
			height: 145, 
			width: 270,
			resizable: false, 
			isModal: true, 
			modalOpacity: 0.3,
			okButton: $('#ok'), 
			cancelButton: $('#cancel'),
			initContent: function () {
				$('#ok').jqxButton({ width: '65px' });
				$('#cancel').jqxButton({ width: '65px' });
				$('#ok').focus();
			}
		});
		
		$('#wmsg').on('close', function (event) {
			$('#wmsg').jqxWindow('destroy');
		});
	} else {			
		if (vautoClose == undefined)
			vautoClose = true;
			
		if (icon == '' || tipo.toUpperCase() == 'I')
			icon = 'info';

		if (tipo.toUpperCase() == 'E')
			icon = 'error';
		else
		if (tipo.toUpperCase() == 'A')
			icon = 'warning';
		else
		if (tipo.toUpperCase() == 'S')
			icon = 'success';			
		else
		if (tipo.toUpperCase() == 'M')
			icon = 'mail';
		else
		if (tipo.toUpperCase() == 'T')
			icon = 'time';
		else
			icon = 'info';

		html = '<div id="wmsg">'+msg+'</div>';
		$('#containerMsg').css('left',window.innerWidth / 2 - 150);
		$('#containerMsg').css('top',window.innerHeight / 2 - 200);

		//$('#containerMsg').css('border','1px solid #000');
		$('#containerMsg').html(html);
		$('#wmsg').jqxNotification({
			//width: 400,
			position: "top-left", 
			opacity: 0.9,
            autoOpen: true, 
			animationOpenDelay: 800, 
			autoClose: vautoClose, 
			autoCloseDelay: 3000,
			template: icon,
			appendContainer: "#containerMsg",
		});
		
		$('#wmsg').on('close', function (event) {
			$('#wmsg').jqxNotification('destroy');
		});
	}	
}